#pragma once
#include "Manager.h"
#include <iostream>
#include "msclr\marshal_cppstd.h"
#include <string>
#include <time.h>


namespace CS2103v01 {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for AddTransaction
	/// </summary>
	public ref class AddTransaction : public System::Windows::Forms::Form
	{
	public:
		AddTransaction(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			TM = Manager::get();
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~AddTransaction()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TabControl^  tabControl1;
	protected: 
	private: System::Windows::Forms::TabPage^  tabPage1;
	private: System::Windows::Forms::Button^  button2;
	private: System::Windows::Forms::Button^  button1;
	private: System::Windows::Forms::TextBox^  textBox1;
	private: System::Windows::Forms::Label^  label5;
	private: System::Windows::Forms::Label^  label4;
	private: System::Windows::Forms::ComboBox^  comboBox3;

	private: System::Windows::Forms::Label^  label3;
	private: System::Windows::Forms::DateTimePicker^  dateTimePicker1;
	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::ComboBox^  comboBox1;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::TabPage^  tabPage2;
	private: System::Windows::Forms::TextBox^  textBox2;
	private: System::Windows::Forms::ComboBox^  comboBox7;
	private: System::Windows::Forms::Label^  label11;
	private: System::Windows::Forms::ComboBox^  comboBox6;
	private: System::Windows::Forms::DateTimePicker^  dateTimePicker2;
	private: System::Windows::Forms::Button^  button4;
	private: System::Windows::Forms::Button^  button3;
	private: System::Windows::Forms::Label^  label10;
	private: System::Windows::Forms::Label^  label9;
	private: System::Windows::Forms::Label^  label8;
	private: System::Windows::Forms::ComboBox^  comboBox5;
	private: System::Windows::Forms::Label^  label7;
	private: System::Windows::Forms::ComboBox^  comboBox4;
	private: System::Windows::Forms::Label^  label6;
	private: System::Windows::Forms::TabPage^  tabPage3;
	private: System::Windows::Forms::Button^  button6;
	private: System::Windows::Forms::Button^  button5;
	private: System::Windows::Forms::TextBox^  textBox3;
	private: System::Windows::Forms::Label^  label17;
	private: System::Windows::Forms::ComboBox^  comboBox11;
	private: System::Windows::Forms::Label^  label16;
	private: System::Windows::Forms::ComboBox^  comboBox10;
	private: System::Windows::Forms::Label^  label15;
	private: System::Windows::Forms::DateTimePicker^  dateTimePicker3;
	private: System::Windows::Forms::Label^  label14;
	private: System::Windows::Forms::ComboBox^  comboBox9;
	private: System::Windows::Forms::ComboBox^  comboBox8;
	private: System::Windows::Forms::Label^  label13;
	private: System::Windows::Forms::Label^  label12;

	private:
		/// <summary>
		/// Required designer variable.
		Manager* TM;
	private: System::Windows::Forms::Label^  label18;
	private: System::Windows::Forms::Label^  label19;
	private: System::Windows::Forms::Label^  label20;
	private: System::Windows::Forms::Label^  label21;
	private: System::Windows::Forms::ComboBox^  comboBox2;
			 /// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
			this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
			this->label18 = (gcnew System::Windows::Forms::Label());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
			this->label5 = (gcnew System::Windows::Forms::Label());
			this->label4 = (gcnew System::Windows::Forms::Label());
			this->comboBox3 = (gcnew System::Windows::Forms::ComboBox());
			this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
			this->label3 = (gcnew System::Windows::Forms::Label());
			this->dateTimePicker1 = (gcnew System::Windows::Forms::DateTimePicker());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
			this->label19 = (gcnew System::Windows::Forms::Label());
			this->textBox2 = (gcnew System::Windows::Forms::TextBox());
			this->comboBox7 = (gcnew System::Windows::Forms::ComboBox());
			this->label11 = (gcnew System::Windows::Forms::Label());
			this->comboBox6 = (gcnew System::Windows::Forms::ComboBox());
			this->dateTimePicker2 = (gcnew System::Windows::Forms::DateTimePicker());
			this->button4 = (gcnew System::Windows::Forms::Button());
			this->button3 = (gcnew System::Windows::Forms::Button());
			this->label10 = (gcnew System::Windows::Forms::Label());
			this->label9 = (gcnew System::Windows::Forms::Label());
			this->label8 = (gcnew System::Windows::Forms::Label());
			this->comboBox5 = (gcnew System::Windows::Forms::ComboBox());
			this->label7 = (gcnew System::Windows::Forms::Label());
			this->comboBox4 = (gcnew System::Windows::Forms::ComboBox());
			this->label6 = (gcnew System::Windows::Forms::Label());
			this->tabPage3 = (gcnew System::Windows::Forms::TabPage());
			this->label21 = (gcnew System::Windows::Forms::Label());
			this->label20 = (gcnew System::Windows::Forms::Label());
			this->button6 = (gcnew System::Windows::Forms::Button());
			this->button5 = (gcnew System::Windows::Forms::Button());
			this->textBox3 = (gcnew System::Windows::Forms::TextBox());
			this->label17 = (gcnew System::Windows::Forms::Label());
			this->comboBox11 = (gcnew System::Windows::Forms::ComboBox());
			this->label16 = (gcnew System::Windows::Forms::Label());
			this->comboBox10 = (gcnew System::Windows::Forms::ComboBox());
			this->label15 = (gcnew System::Windows::Forms::Label());
			this->dateTimePicker3 = (gcnew System::Windows::Forms::DateTimePicker());
			this->label14 = (gcnew System::Windows::Forms::Label());
			this->comboBox9 = (gcnew System::Windows::Forms::ComboBox());
			this->comboBox8 = (gcnew System::Windows::Forms::ComboBox());
			this->label13 = (gcnew System::Windows::Forms::Label());
			this->label12 = (gcnew System::Windows::Forms::Label());
			this->tabControl1->SuspendLayout();
			this->tabPage1->SuspendLayout();
			this->tabPage2->SuspendLayout();
			this->tabPage3->SuspendLayout();
			this->SuspendLayout();
			// 
			// tabControl1
			// 
			this->tabControl1->Controls->Add(this->tabPage1);
			this->tabControl1->Controls->Add(this->tabPage2);
			this->tabControl1->Controls->Add(this->tabPage3);
			this->tabControl1->Font = (gcnew System::Drawing::Font(L"Microsoft YaHei", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(134)));
			this->tabControl1->Location = System::Drawing::Point(25, 23);
			this->tabControl1->Name = L"tabControl1";
			this->tabControl1->SelectedIndex = 0;
			this->tabControl1->Size = System::Drawing::Size(362, 454);
			this->tabControl1->TabIndex = 0;
			// 
			// tabPage1
			// 
			this->tabPage1->Controls->Add(this->label18);
			this->tabPage1->Controls->Add(this->button2);
			this->tabPage1->Controls->Add(this->button1);
			this->tabPage1->Controls->Add(this->textBox1);
			this->tabPage1->Controls->Add(this->label5);
			this->tabPage1->Controls->Add(this->label4);
			this->tabPage1->Controls->Add(this->comboBox3);
			this->tabPage1->Controls->Add(this->comboBox2);
			this->tabPage1->Controls->Add(this->label3);
			this->tabPage1->Controls->Add(this->dateTimePicker1);
			this->tabPage1->Controls->Add(this->label2);
			this->tabPage1->Controls->Add(this->comboBox1);
			this->tabPage1->Controls->Add(this->label1);
			this->tabPage1->Location = System::Drawing::Point(4, 26);
			this->tabPage1->Name = L"tabPage1";
			this->tabPage1->Padding = System::Windows::Forms::Padding(3);
			this->tabPage1->Size = System::Drawing::Size(354, 424);
			this->tabPage1->TabIndex = 0;
			this->tabPage1->Text = L"Income";
			this->tabPage1->UseVisualStyleBackColor = true;
			this->tabPage1->Enter += gcnew System::EventHandler(this, &AddTransaction::tabPage1_Enter);
			// 
			// label18
			// 
			this->label18->AutoSize = true;
			this->label18->Font = (gcnew System::Drawing::Font(L"Microsoft YaHei", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(134)));
			this->label18->ForeColor = System::Drawing::Color::Red;
			this->label18->Location = System::Drawing::Point(135, 211);
			this->label18->Name = L"label18";
			this->label18->Size = System::Drawing::Size(45, 16);
			this->label18->TabIndex = 12;
			this->label18->Text = L"label18";
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(237, 328);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(75, 23);
			this->button2->TabIndex = 11;
			this->button2->Text = L"Cancel";
			this->button2->UseVisualStyleBackColor = true;
			this->button2->Click += gcnew System::EventHandler(this, &AddTransaction::button2_Click);
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(42, 328);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(75, 23);
			this->button1->TabIndex = 10;
			this->button1->Text = L"Save";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &AddTransaction::button1_Click);
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(135, 188);
			this->textBox1->Name = L"textBox1";
			this->textBox1->Size = System::Drawing::Size(100, 23);
			this->textBox1->TabIndex = 9;
			// 
			// label5
			// 
			this->label5->AutoSize = true;
			this->label5->Location = System::Drawing::Point(40, 192);
			this->label5->Name = L"label5";
			this->label5->Size = System::Drawing::Size(53, 17);
			this->label5->TabIndex = 8;
			this->label5->Text = L"Amount";
			// 
			// label4
			// 
			this->label4->AutoSize = true;
			this->label4->Location = System::Drawing::Point(177, 148);
			this->label4->Name = L"label4";
			this->label4->Size = System::Drawing::Size(11, 17);
			this->label4->TabIndex = 7;
			this->label4->Text = L":";
			// 
			// comboBox3
			// 
			this->comboBox3->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox3->FormattingEnabled = true;
			this->comboBox3->Items->AddRange(gcnew cli::array< System::Object^  >(60) {L"00", L"01", L"02", L"03", L"04", L"05", L"06", 
				L"07", L"08", L"09", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23", L"24", 
				L"25", L"26", L"27", L"28", L"29", L"30", L"31", L"32", L"33", L"34", L"35", L"36", L"37", L"38", L"39", L"40", L"41", L"42", 
				L"43", L"44", L"45", L"46", L"47", L"48", L"49", L"50", L"51", L"52", L"53", L"54", L"55", L"56", L"57", L"58", L"59"});
			this->comboBox3->Location = System::Drawing::Point(188, 144);
			this->comboBox3->Name = L"comboBox3";
			this->comboBox3->Size = System::Drawing::Size(42, 25);
			this->comboBox3->TabIndex = 6;
			// 
			// comboBox2
			// 
			this->comboBox2->AutoCompleteMode = System::Windows::Forms::AutoCompleteMode::Append;
			this->comboBox2->AutoCompleteSource = System::Windows::Forms::AutoCompleteSource::ListItems;
			this->comboBox2->Cursor = System::Windows::Forms::Cursors::Default;
			this->comboBox2->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox2->FormattingEnabled = true;
			this->comboBox2->Items->AddRange(gcnew cli::array< System::Object^  >(24) {L"00", L"01", L"02", L"03", L"04", L"05", L"06", 
				L"07", L"08", L"09", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23"});
			this->comboBox2->Location = System::Drawing::Point(135, 144);
			this->comboBox2->Name = L"comboBox2";
			this->comboBox2->Size = System::Drawing::Size(42, 25);
			this->comboBox2->TabIndex = 5;
			// 
			// label3
			// 
			this->label3->AutoSize = true;
			this->label3->Location = System::Drawing::Point(40, 148);
			this->label3->Name = L"label3";
			this->label3->Size = System::Drawing::Size(36, 17);
			this->label3->TabIndex = 4;
			this->label3->Text = L"Time";
			// 
			// dateTimePicker1
			// 
			this->dateTimePicker1->Location = System::Drawing::Point(135, 100);
			this->dateTimePicker1->Name = L"dateTimePicker1";
			this->dateTimePicker1->Size = System::Drawing::Size(200, 23);
			this->dateTimePicker1->TabIndex = 3;
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Location = System::Drawing::Point(40, 104);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(35, 17);
			this->label2->TabIndex = 2;
			this->label2->Text = L"Date";
			// 
			// comboBox1
			// 
			this->comboBox1->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox1->FormattingEnabled = true;
			this->comboBox1->Location = System::Drawing::Point(135, 56);
			this->comboBox1->Name = L"comboBox1";
			this->comboBox1->Size = System::Drawing::Size(121, 25);
			this->comboBox1->TabIndex = 1;
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(40, 60);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(54, 17);
			this->label1->TabIndex = 0;
			this->label1->Text = L"Account";
			// 
			// tabPage2
			// 
			this->tabPage2->Controls->Add(this->label19);
			this->tabPage2->Controls->Add(this->textBox2);
			this->tabPage2->Controls->Add(this->comboBox7);
			this->tabPage2->Controls->Add(this->label11);
			this->tabPage2->Controls->Add(this->comboBox6);
			this->tabPage2->Controls->Add(this->dateTimePicker2);
			this->tabPage2->Controls->Add(this->button4);
			this->tabPage2->Controls->Add(this->button3);
			this->tabPage2->Controls->Add(this->label10);
			this->tabPage2->Controls->Add(this->label9);
			this->tabPage2->Controls->Add(this->label8);
			this->tabPage2->Controls->Add(this->comboBox5);
			this->tabPage2->Controls->Add(this->label7);
			this->tabPage2->Controls->Add(this->comboBox4);
			this->tabPage2->Controls->Add(this->label6);
			this->tabPage2->Location = System::Drawing::Point(4, 26);
			this->tabPage2->Name = L"tabPage2";
			this->tabPage2->Padding = System::Windows::Forms::Padding(3);
			this->tabPage2->Size = System::Drawing::Size(354, 424);
			this->tabPage2->TabIndex = 1;
			this->tabPage2->Text = L"Expense";
			this->tabPage2->UseVisualStyleBackColor = true;
			this->tabPage2->Enter += gcnew System::EventHandler(this, &AddTransaction::tabPage2_Enter);
			// 
			// label19
			// 
			this->label19->AutoSize = true;
			this->label19->Font = (gcnew System::Drawing::Font(L"Microsoft YaHei", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(134)));
			this->label19->ForeColor = System::Drawing::Color::Red;
			this->label19->Location = System::Drawing::Point(135, 255);
			this->label19->Name = L"label19";
			this->label19->Size = System::Drawing::Size(45, 16);
			this->label19->TabIndex = 14;
			this->label19->Text = L"label19";
			// 
			// textBox2
			// 
			this->textBox2->Location = System::Drawing::Point(135, 232);
			this->textBox2->Name = L"textBox2";
			this->textBox2->Size = System::Drawing::Size(100, 23);
			this->textBox2->TabIndex = 13;
			// 
			// comboBox7
			// 
			this->comboBox7->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox7->FormattingEnabled = true;
			this->comboBox7->Items->AddRange(gcnew cli::array< System::Object^  >(60) {L"00", L"01", L"02", L"03", L"04", L"05", L"06", 
				L"07", L"08", L"09", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23", L"24", 
				L"25", L"26", L"27", L"28", L"29", L"30", L"31", L"32", L"33", L"34", L"35", L"36", L"37", L"38", L"39", L"40", L"41", L"42", 
				L"43", L"44", L"45", L"46", L"47", L"48", L"49", L"50", L"51", L"52", L"53", L"54", L"55", L"56", L"57", L"58", L"59"});
			this->comboBox7->Location = System::Drawing::Point(188, 188);
			this->comboBox7->Name = L"comboBox7";
			this->comboBox7->Size = System::Drawing::Size(42, 25);
			this->comboBox7->TabIndex = 12;
			// 
			// label11
			// 
			this->label11->AutoSize = true;
			this->label11->Location = System::Drawing::Point(177, 192);
			this->label11->Name = L"label11";
			this->label11->Size = System::Drawing::Size(11, 17);
			this->label11->TabIndex = 11;
			this->label11->Text = L":";
			// 
			// comboBox6
			// 
			this->comboBox6->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox6->FormattingEnabled = true;
			this->comboBox6->Items->AddRange(gcnew cli::array< System::Object^  >(24) {L"00", L"01", L"02", L"03", L"04", L"05", L"06", 
				L"07", L"08", L"09", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23"});
			this->comboBox6->Location = System::Drawing::Point(135, 188);
			this->comboBox6->Name = L"comboBox6";
			this->comboBox6->Size = System::Drawing::Size(42, 25);
			this->comboBox6->TabIndex = 10;
			// 
			// dateTimePicker2
			// 
			this->dateTimePicker2->Location = System::Drawing::Point(135, 144);
			this->dateTimePicker2->Name = L"dateTimePicker2";
			this->dateTimePicker2->Size = System::Drawing::Size(200, 23);
			this->dateTimePicker2->TabIndex = 9;
			// 
			// button4
			// 
			this->button4->Location = System::Drawing::Point(237, 328);
			this->button4->Name = L"button4";
			this->button4->Size = System::Drawing::Size(75, 23);
			this->button4->TabIndex = 8;
			this->button4->Text = L"Cancel";
			this->button4->UseVisualStyleBackColor = true;
			this->button4->Click += gcnew System::EventHandler(this, &AddTransaction::button4_Click);
			// 
			// button3
			// 
			this->button3->Location = System::Drawing::Point(42, 328);
			this->button3->Name = L"button3";
			this->button3->Size = System::Drawing::Size(75, 23);
			this->button3->TabIndex = 7;
			this->button3->Text = L"Save";
			this->button3->UseVisualStyleBackColor = true;
			this->button3->Click += gcnew System::EventHandler(this, &AddTransaction::button3_Click);
			// 
			// label10
			// 
			this->label10->AutoSize = true;
			this->label10->Location = System::Drawing::Point(40, 236);
			this->label10->Name = L"label10";
			this->label10->Size = System::Drawing::Size(53, 17);
			this->label10->TabIndex = 6;
			this->label10->Text = L"Amount";
			// 
			// label9
			// 
			this->label9->AutoSize = true;
			this->label9->Location = System::Drawing::Point(40, 192);
			this->label9->Name = L"label9";
			this->label9->Size = System::Drawing::Size(36, 17);
			this->label9->TabIndex = 5;
			this->label9->Text = L"Time";
			// 
			// label8
			// 
			this->label8->AutoSize = true;
			this->label8->Location = System::Drawing::Point(40, 148);
			this->label8->Name = L"label8";
			this->label8->Size = System::Drawing::Size(35, 17);
			this->label8->TabIndex = 4;
			this->label8->Text = L"Date";
			// 
			// comboBox5
			// 
			this->comboBox5->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox5->FormattingEnabled = true;
			this->comboBox5->Location = System::Drawing::Point(135, 100);
			this->comboBox5->Name = L"comboBox5";
			this->comboBox5->Size = System::Drawing::Size(121, 25);
			this->comboBox5->TabIndex = 3;
			// 
			// label7
			// 
			this->label7->AutoSize = true;
			this->label7->Location = System::Drawing::Point(40, 104);
			this->label7->Name = L"label7";
			this->label7->Size = System::Drawing::Size(61, 17);
			this->label7->TabIndex = 2;
			this->label7->Text = L"Category";
			// 
			// comboBox4
			// 
			this->comboBox4->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox4->FormattingEnabled = true;
			this->comboBox4->Location = System::Drawing::Point(135, 56);
			this->comboBox4->Name = L"comboBox4";
			this->comboBox4->Size = System::Drawing::Size(121, 25);
			this->comboBox4->TabIndex = 1;
			// 
			// label6
			// 
			this->label6->AutoSize = true;
			this->label6->Location = System::Drawing::Point(40, 60);
			this->label6->Name = L"label6";
			this->label6->Size = System::Drawing::Size(54, 17);
			this->label6->TabIndex = 0;
			this->label6->Text = L"Account";
			// 
			// tabPage3
			// 
			this->tabPage3->Controls->Add(this->label21);
			this->tabPage3->Controls->Add(this->label20);
			this->tabPage3->Controls->Add(this->button6);
			this->tabPage3->Controls->Add(this->button5);
			this->tabPage3->Controls->Add(this->textBox3);
			this->tabPage3->Controls->Add(this->label17);
			this->tabPage3->Controls->Add(this->comboBox11);
			this->tabPage3->Controls->Add(this->label16);
			this->tabPage3->Controls->Add(this->comboBox10);
			this->tabPage3->Controls->Add(this->label15);
			this->tabPage3->Controls->Add(this->dateTimePicker3);
			this->tabPage3->Controls->Add(this->label14);
			this->tabPage3->Controls->Add(this->comboBox9);
			this->tabPage3->Controls->Add(this->comboBox8);
			this->tabPage3->Controls->Add(this->label13);
			this->tabPage3->Controls->Add(this->label12);
			this->tabPage3->Location = System::Drawing::Point(4, 26);
			this->tabPage3->Name = L"tabPage3";
			this->tabPage3->Padding = System::Windows::Forms::Padding(3);
			this->tabPage3->Size = System::Drawing::Size(354, 424);
			this->tabPage3->TabIndex = 2;
			this->tabPage3->Text = L"Transfer";
			this->tabPage3->UseVisualStyleBackColor = true;
			this->tabPage3->Enter += gcnew System::EventHandler(this, &AddTransaction::tabPage3_Enter);
			// 
			// label21
			// 
			this->label21->AutoSize = true;
			this->label21->Font = (gcnew System::Drawing::Font(L"Microsoft YaHei", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(134)));
			this->label21->ForeColor = System::Drawing::Color::Red;
			this->label21->Location = System::Drawing::Point(135, 125);
			this->label21->Name = L"label21";
			this->label21->Size = System::Drawing::Size(45, 16);
			this->label21->TabIndex = 15;
			this->label21->Text = L"label21";
			// 
			// label20
			// 
			this->label20->AutoSize = true;
			this->label20->Font = (gcnew System::Drawing::Font(L"Microsoft YaHei", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(134)));
			this->label20->ForeColor = System::Drawing::Color::Red;
			this->label20->Location = System::Drawing::Point(135, 255);
			this->label20->Name = L"label20";
			this->label20->Size = System::Drawing::Size(45, 16);
			this->label20->TabIndex = 14;
			this->label20->Text = L"label20";
			// 
			// button6
			// 
			this->button6->Location = System::Drawing::Point(237, 328);
			this->button6->Name = L"button6";
			this->button6->Size = System::Drawing::Size(75, 23);
			this->button6->TabIndex = 13;
			this->button6->Text = L"Cancel";
			this->button6->UseVisualStyleBackColor = true;
			this->button6->Click += gcnew System::EventHandler(this, &AddTransaction::button6_Click);
			// 
			// button5
			// 
			this->button5->Location = System::Drawing::Point(42, 328);
			this->button5->Name = L"button5";
			this->button5->Size = System::Drawing::Size(75, 23);
			this->button5->TabIndex = 12;
			this->button5->Text = L"Save";
			this->button5->UseVisualStyleBackColor = true;
			this->button5->Click += gcnew System::EventHandler(this, &AddTransaction::button5_Click);
			// 
			// textBox3
			// 
			this->textBox3->Location = System::Drawing::Point(135, 232);
			this->textBox3->Name = L"textBox3";
			this->textBox3->Size = System::Drawing::Size(100, 23);
			this->textBox3->TabIndex = 11;
			// 
			// label17
			// 
			this->label17->AutoSize = true;
			this->label17->Location = System::Drawing::Point(40, 236);
			this->label17->Name = L"label17";
			this->label17->Size = System::Drawing::Size(53, 17);
			this->label17->TabIndex = 10;
			this->label17->Text = L"Amount";
			// 
			// comboBox11
			// 
			this->comboBox11->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox11->FormattingEnabled = true;
			this->comboBox11->Items->AddRange(gcnew cli::array< System::Object^  >(60) {L"00", L"01", L"02", L"03", L"04", L"05", L"06", 
				L"07", L"08", L"09", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23", L"24", 
				L"25", L"26", L"27", L"28", L"29", L"30", L"31", L"32", L"33", L"34", L"35", L"36", L"37", L"38", L"39", L"40", L"41", L"42", 
				L"43", L"44", L"45", L"46", L"47", L"48", L"49", L"50", L"51", L"52", L"53", L"54", L"55", L"56", L"57", L"58", L"59"});
			this->comboBox11->Location = System::Drawing::Point(188, 188);
			this->comboBox11->Name = L"comboBox11";
			this->comboBox11->Size = System::Drawing::Size(42, 25);
			this->comboBox11->TabIndex = 9;
			// 
			// label16
			// 
			this->label16->AutoSize = true;
			this->label16->Location = System::Drawing::Point(177, 192);
			this->label16->Name = L"label16";
			this->label16->Size = System::Drawing::Size(11, 17);
			this->label16->TabIndex = 8;
			this->label16->Text = L":";
			// 
			// comboBox10
			// 
			this->comboBox10->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox10->FormattingEnabled = true;
			this->comboBox10->Items->AddRange(gcnew cli::array< System::Object^  >(24) {L"00", L"01", L"02", L"03", L"04", L"05", L"06", 
				L"07", L"08", L"09", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23"});
			this->comboBox10->Location = System::Drawing::Point(135, 188);
			this->comboBox10->Name = L"comboBox10";
			this->comboBox10->Size = System::Drawing::Size(42, 25);
			this->comboBox10->TabIndex = 7;
			// 
			// label15
			// 
			this->label15->AutoSize = true;
			this->label15->Location = System::Drawing::Point(40, 192);
			this->label15->Name = L"label15";
			this->label15->Size = System::Drawing::Size(36, 17);
			this->label15->TabIndex = 6;
			this->label15->Text = L"Time";
			// 
			// dateTimePicker3
			// 
			this->dateTimePicker3->Location = System::Drawing::Point(135, 144);
			this->dateTimePicker3->Name = L"dateTimePicker3";
			this->dateTimePicker3->Size = System::Drawing::Size(200, 23);
			this->dateTimePicker3->TabIndex = 5;
			// 
			// label14
			// 
			this->label14->AutoSize = true;
			this->label14->Location = System::Drawing::Point(40, 148);
			this->label14->Name = L"label14";
			this->label14->Size = System::Drawing::Size(35, 17);
			this->label14->TabIndex = 4;
			this->label14->Text = L"Date";
			// 
			// comboBox9
			// 
			this->comboBox9->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox9->FormattingEnabled = true;
			this->comboBox9->Location = System::Drawing::Point(135, 100);
			this->comboBox9->Name = L"comboBox9";
			this->comboBox9->Size = System::Drawing::Size(121, 25);
			this->comboBox9->TabIndex = 3;
			// 
			// comboBox8
			// 
			this->comboBox8->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->comboBox8->FormattingEnabled = true;
			this->comboBox8->Location = System::Drawing::Point(135, 56);
			this->comboBox8->Name = L"comboBox8";
			this->comboBox8->Size = System::Drawing::Size(121, 25);
			this->comboBox8->TabIndex = 2;
			// 
			// label13
			// 
			this->label13->AutoSize = true;
			this->label13->Location = System::Drawing::Point(40, 104);
			this->label13->Name = L"label13";
			this->label13->Size = System::Drawing::Size(73, 17);
			this->label13->TabIndex = 1;
			this->label13->Text = L"To Account";
			// 
			// label12
			// 
			this->label12->AutoSize = true;
			this->label12->Location = System::Drawing::Point(40, 60);
			this->label12->Name = L"label12";
			this->label12->Size = System::Drawing::Size(88, 17);
			this->label12->TabIndex = 0;
			this->label12->Text = L"From Account";
			// 
			// AddTransaction
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(413, 500);
			this->Controls->Add(this->tabControl1);
			this->Name = L"AddTransaction";
			this->Text = L"Add Transaction";
			this->Load += gcnew System::EventHandler(this, &AddTransaction::AddTransaction_Load);
			this->tabControl1->ResumeLayout(false);
			this->tabPage1->ResumeLayout(false);
			this->tabPage1->PerformLayout();
			this->tabPage2->ResumeLayout(false);
			this->tabPage2->PerformLayout();
			this->tabPage3->ResumeLayout(false);
			this->tabPage3->PerformLayout();
			this->ResumeLayout(false);

		}
		//@author A0090982W
#pragma endregion
	private: System::Void AddTransaction_Load(System::Object^  sender, System::EventArgs^  e) {
			 }
	private: System::Void tabPage1_Enter(System::Object^  sender, System::EventArgs^  e) {
				 label18->Text="";
				 setUpComboBox("acc", comboBox1);
				 setUpComboBox("hour", comboBox2);
				 setUpComboBox("min", comboBox3);
			 }
	private: System::Void tabPage2_Enter(System::Object^  sender, System::EventArgs^  e) {
				 label19->Text="";
				 setUpComboBox("acc", comboBox4);
				 setUpComboBox("cat", comboBox5);
				 setUpComboBox("hour", comboBox6);
				 setUpComboBox("min", comboBox7);
			 }
	private: System::Void tabPage3_Enter(System::Object^  sender, System::EventArgs^  e) {
				 label20->Text="";
				 label21->Text="";
				 setUpComboBox("acc", comboBox8);
				 setUpComboBox("acc", comboBox9);
				 setUpComboBox("hour", comboBox10);
				 setUpComboBox("min", comboBox11);
			 }

	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
				 //save INCOME
				 if(!checkField(textBox1, label18))
					 return;

				 string account;
				 struct dateTime DT;
				 double amount;
				 int SN;

				 account = msclr::interop::marshal_as<std::string>(comboBox1->Text);
				 DT.year = System::Convert::ToInt32(dateTimePicker1->Value.Year);
				 DT.month = System::Convert::ToInt32(dateTimePicker1->Value.Month);
				 DT.day = System::Convert::ToInt32(dateTimePicker1->Value.Day);
				 DT.hour = System::Convert::ToInt32(comboBox2->Text);
				 DT.minute = System::Convert::ToInt32(comboBox3->Text);
				 amount = System::Convert::ToDouble(textBox1->Text);
				 SN = *(TM->getSNAddr());

				 if(amount<0)
				 {
					 label18->Text="must be positive";
					 return;
				 }

				 Income* I = new Income(amount, SN, DT, account);

				 if(TM->addTransaction(I))
					 this->Close();
				 else
					 MessageBox::Show("Failed!");
			 }
	private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
				 //save EXPENSE
				 if(!checkField(textBox2, label19))
					 return;

				 string account;
				 string category;
				 struct dateTime DT;
				 double amount;
				 int SN;

				 account = msclr::interop::marshal_as<std::string>(comboBox4->Text);
				 category =  msclr::interop::marshal_as<std::string>(comboBox5->Text);
				 DT.year = System::Convert::ToInt32(dateTimePicker2->Value.Year);
				 DT.month = System::Convert::ToInt32(dateTimePicker2->Value.Month);
				 DT.day = System::Convert::ToInt32(dateTimePicker2->Value.Day);
				 DT.hour = System::Convert::ToInt32(comboBox6->Text);
				 DT.minute = System::Convert::ToInt32(comboBox7->Text);
				 amount = System::Convert::ToDouble(textBox2->Text);
				 SN = *(TM->getSNAddr());
				 
				 //check amount>=0
				 if(amount<0)
				 {
					 label19->Text="must be positive";
					 return;
				 }
				 //check enough bal
				 if(!TM->enoughBal(account, amount))
				 {
					 label19->Text="Not Enough Balance...";
					 return;
				 }

				 Expense* E = new Expense(amount, SN, DT, category, account);
				 if(TM->addTransaction(E))
					 this->Close();
				 else
					 MessageBox::Show("Failed!");
			 }
	private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
				 //save TRANSFER
				 if(!checkField(textBox3, label20))
					 return;
				 label21->Text="";
				 if(comboBox8->Text==comboBox9->Text)
				 {
					 label21->Text="Please choose a different account";
					 return;
				 }

				 string Faccount;
				 string Taccount;
				 struct dateTime DT;
				 double amount;
				 int SN;

				 Faccount = msclr::interop::marshal_as<std::string>(comboBox8->Text);
				 Taccount =  msclr::interop::marshal_as<std::string>(comboBox9->Text);
				 DT.year = System::Convert::ToInt32(dateTimePicker3->Value.Year);
				 DT.month = System::Convert::ToInt32(dateTimePicker3->Value.Month);
				 DT.day = System::Convert::ToInt32(dateTimePicker3->Value.Day);
				 DT.hour = System::Convert::ToInt32(comboBox10->Text);
				 DT.minute = System::Convert::ToInt32(comboBox11->Text);
				 amount = System::Convert::ToDouble(textBox3->Text);
				 SN = *(TM->getSNAddr());
				 
				 //check amount>=0
				 if(amount<0)
				 {
					 label20->Text="must be positive";
					 return;
				 }

				 //check enough bal
				 if(!(TM->enoughBal(Faccount, amount)))
				 {
					 label20->Text="Not Enough Balance";
					 return;
				 }

				 Transfer* T = new Transfer(amount, SN, DT, Faccount, Taccount);
				 if(TM->addTransaction(T))
					 this->Close();
				 else
					 MessageBox::Show("Failed!");
			 }

	private: System::Void button6_Click(System::Object^  sender, System::EventArgs^  e) {
				 this->Close();
			 }
	private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
				 this->Close();
			 }
	private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
				 this->Close();
			 }

	private: void setUpComboBox(string type, ComboBox^CB)
			 {
				 if(type=="acc")
				 {
					 CB->Items->Clear();
					 if(!((TM->getAccAddr())->empty()))
					 {
						 list<string>::iterator iterA;
						 String ^ tempAcc;
						 for(iterA = (TM->getAccAddr())->begin(); iterA != (TM->getAccAddr())->end(); iterA++)
						 {
							 if(*iterA!="delete")
							 {
								 tempAcc =  msclr::interop::marshal_as<System::String^>(*iterA);
								 CB->Items->Add(tempAcc);
							 }
						 }
						 CB->SelectedIndex = 0;
					 }
				 }
				 else if(type=="cat")
				 {
					 CB->Items->Clear();

					 if(!((TM->getCatAddr())->empty()))
					 {
						 list<string>::iterator iterC = TM->getCatAddr()->begin();
						 String ^ tempCat;
						 for(; iterC != (TM->getCatAddr())->end(); iterC++)
						 {
							 if(*iterC!="Income" && *iterC!="Transfer")
							 {
								 tempCat =  msclr::interop::marshal_as<System::String^>(*iterC);
								 CB->Items->Add(tempCat);
							 }
						 }
						 CB->SelectedIndex = 0;
					 }
				 }
				 else if(type=="hour")
				 {
					 CB->SelectedIndex = TM->NOW().hour;
				 }
				 else if(type=="min")
				 {
					  CB->SelectedIndex = TM->NOW().minute;
				 }

				 else
					 return;
			 }
	private: bool checkField(TextBox^ amt, Label^ amtL)
			 {
				 amtL->Text="";
				 bool miss=false;
				 bool format=true;

				 //check empty field
				 if(amt->Text=="")
				 {
					 amtL->Text="missing";
					 miss = true;
				 }
				 if(miss)
					 return false;

				 //check format
				 if(!(TM->checkDouble(msclr::interop::marshal_as<std::string>(amt->Text))))
				 {
					 amtL->Text="Not numeric";
					 format=false;
				 }
				 else if(!TM->checkDP(msclr::interop::marshal_as<std::string>(amt->Text)))
				 {
					 amtL->Text="exceeded precision";
					 format = false;
				 }
				 return format;
			 }
};
}
